import random
r=random.Random()
nh=0
n=0
var=1#r,var,n will help to take decision
def hunt_choice(round_number,current_food,m,player_reputations):
    hunt_decisions=[]
    global var
    global n
    global nh
    if n<.9 and var==-1:
        n=n-(var-1)*.025-nh/len(player_reputations)*.025#modification of n which helps to decise var==-1 indicates tf<0 & hunting should be lessened(n sould increase) & nh gives hunter number which indicates cooperative hunter which indicates hunting may be increased so lessening n
    av_reput=sum(player_reputations)/len(player_reputations)
    for i in range(len(player_reputations)):
        if round_number==1:
            hunt_decision.append('h')#will alaways hunt in round 1
        elif round_number>1:#do another if round_number isn't 1
            if player_reputations[i]>(av_reput+n):
                hunt_decision.append('h')#hunt if player has more reputation & hunting tendency
            elif player_reputations[i]<(av_reput+n):           
                hunt_decision.append('s')#slack if player has more reputation & slacking tendency
            else:#will decise to hunt or slack randomly
                r=randrange(1,3)
                if r==2:
                    hunt_decision.append('s')
                else:
                    hunt_decision.append('h')
    return hunt_decisions      
def hunt_outcomes(food_earnings):
    global var
    tf=sum(food_earnings)
    if tf<0:#modify var if tf is negative(food is lost)
        var=-1
    else:#modify var if tf is positive(food is gained)
        var=1    
def round_end(award,m,number_hunters):
    global nh
    nh=number_hunters
